package com.info.zhiduoduo.pay.controller;

import com.info.zhiduoduo.common.constants.SmartResult;
import com.info.zhiduoduo.pay.formbean.zhaoshangbankpay.AlipayAccountQueryFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangbankpay.AlipayTransferFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangbankpay.AlipayTransferQueryFormBean;
import com.info.zhiduoduo.pay.service.AliPayApiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("/alipay")
public class AliPayController {

    @Resource
    AliPayApiService aliPayApiService;

    @ApiOperation("支付宝转账")
    @PostMapping("/agentPay")
    public SmartResult agentPay(@Valid @RequestBody AlipayTransferFormBean formBean) {
        return aliPayApiService.transfer(formBean);
    }

    @ApiOperation("支付宝转账结果查询")
    @PostMapping("/transQuery")
    public SmartResult transQuery(@Valid @RequestBody AlipayTransferQueryFormBean formBean) {
        return aliPayApiService.transQuery(formBean);
    }

    @ApiOperation("支付宝资金账户资产查询接口")
    @PostMapping("/accountQuery")
    public SmartResult accountQuery(@Valid @RequestBody AlipayAccountQueryFormBean formBean) {
        return aliPayApiService.accountQuery(formBean);
    }
}
